using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace CodePlex.Resourceful
{
    public class DecoratedStream : Stream
    {

        private readonly Stream _target;


        public DecoratedStream(Stream target)
        {
            _target = target;
        }



        // must override 
        public override bool CanRead
        {
            get { return _target.CanRead; }
        }

        public override bool CanSeek
        {
            get { return _target.CanSeek; }
        }

        public override bool CanWrite
        {
            get { return _target.CanWrite; }
        }

        public override void Flush()
        {
            _target.Flush();
        }

        public override long Length
        {
            get { return _target.Length; }
        }

        public override long Position
        {
            get
            {
                return _target.Position;
            }
            set
            {
                _target.Position = value;
            }
        }



      

        


        public override int Read(byte[] buffer, int offset, int count)
        {
            return _target.Read(buffer, offset, count);
           
        }

        public override long Seek(long offset, SeekOrigin origin)
        {
            return _target.Seek(offset, origin);
        }

        public override void SetLength(long value)
        {
            _target.SetLength(value);
        }

        public override void Write(byte[] buffer, int offset, int count)
        {
            _target.Write(buffer, offset, count);
        }





        // can override
        public override void Close()
        {
            _target.Close();
        }

      


        public override bool CanTimeout
        {
            get
            {
                return _target.CanTimeout;
            }
        }

#if SILVERLIGHT
#else
        public override System.Runtime.Remoting.ObjRef CreateObjRef(Type requestedType)
        {
            return _target.CreateObjRef(requestedType);
        }
          public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
        {
            return _target.BeginRead(buffer, offset, count, callback, state);
        }

        public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
        {
            return _target.BeginWrite(buffer, offset, count, callback, state);
        }
          public override int EndRead(IAsyncResult asyncResult)
        {
            return _target.EndRead(asyncResult);
        }

        public override void EndWrite(IAsyncResult asyncResult)
        {
            _target.EndWrite(asyncResult);
        }

          public override object InitializeLifetimeService()
        {
            return _target.InitializeLifetimeService();
        }

#endif




        public override bool Equals(object obj)
        {
            return _target.Equals(obj);
        }

        public override int GetHashCode()
        {
            return _target.GetHashCode();
        }



      


        public override int ReadByte()
        {
            return _target.ReadByte();
        }

        public override int ReadTimeout
        {
            get
            {
                return _target.ReadTimeout;
            }
            set
            {
                _target.ReadTimeout = value;
            }
        }


        public override string ToString()
        {
            return _target.ToString();
        }

        public override void WriteByte(byte value)
        {
            _target.WriteByte(value);
        }


        public override int WriteTimeout
        {
            get
            {
                return _target.WriteTimeout;
            }
            set
            {
                _target.WriteTimeout = value;
            }
        }

        

    }

}
